package com.lenovo.lcdmoauth.config;

import org.springframework.security.authentication.AbstractAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.oauth2.server.authorization.util.SpringAuthorizationServerVersion;
import org.springframework.util.Assert;

import java.util.Collections;

public class CustomRevocationAuthenticationToken extends AbstractAuthenticationToken {

    private static final long serialVersionUID;

    private final Authentication clientPrincipal;

    private final String itcode;


    public CustomRevocationAuthenticationToken(String itcode, Authentication clientPrincipal) {
        super(Collections.emptyList());
        Assert.hasText(itcode, "itcode cannot be empty");
        Assert.notNull(clientPrincipal, "clientPrincipal cannot be null");
        this.itcode = itcode;
        this.clientPrincipal = clientPrincipal;
    }

    @Override
    public Object getCredentials() {
        return "";
    }

    @Override
    public Object getPrincipal() {
        return this.clientPrincipal;
    }

    public String getItcode() {
        return itcode;
    }

    static {
        serialVersionUID = SpringAuthorizationServerVersion.SERIAL_VERSION_UID;
    }
}
